package com.nami.dispatcher.types.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.LongAdder;

/**
 * // index 单聊，群聊 index 都是分开的，现在是只有一个index自增
 */
public class IndexGenerator {

    private static final Map<String, LongAdder> INDEX_MAP = new HashMap<>();
    private static final Map<String, String> msg = new HashMap<>();

    public static Long nextIndex(String senderId, String receiverId, String msgId) {
        LongAdder value = INDEX_MAP.getOrDefault(senderId + receiverId, new LongAdder());
        value.increment();
//        msg.put(value + senderId+ receiverId, msgId);
        return value.longValue();
    }

}
